<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">

<title> 自定义测试 - 题目 - Judge Duck Online </title>

<link rel="icon" type="image/png" href="/images/judgeduck-logo-small.png" />

<script src="/libs/js/jquery-3.2.1.min.js"></script>

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="/libs/css/bootstrap.min.css" />

<!-- Latest compiled and minified JavaScript -->
<script src="/libs/js/bootstrap.min.js"></script>

<link rel="stylesheet" type="text/css" href="/css/main.css" />
<link rel="stylesheet" href="/css/non-responsive.css" type="text/css" />

<script src="/js/md5.js"></script>
<script src="/js/judgeduck.js"></script>

<script type="text/x-mathjax-config">
	MathJax.Hub.Config({
		showProcessingMessages: false,
		tex2jax: {
			inlineMath: [["$", "$"], ["\\\\(", "\\\\)"]],
			processEscapes:true
		},
		menuSettings: {
			zoom: "Hover"
		}
	});
</script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@2.7.1/MathJax.js?config=TeX-AMS_HTML"></script>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
<script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>

</head>

<body onload="">

<!-- Fixed navbar -->
<nav class="navbar navbar-default" role="navigation" style="background-color: #eeeeee">
	<div class="container">
		<div class="navbar-header">
			<div class="navbar-brand">
				<a href="/">
					<img src="/images/judgeduck-logo.png" width="40px" height="40px" style="margin:-10px" />
				</a>
			</div>
			<font class="navbar-brand">
				Judge Duck Online
			</font>
		</div>
		<div class="navbar-collapse collapse">
			<ul class="nav navbar-nav">
				<li class="nav-item">
					<a class="nav-link" href="/index/index.html"> 首页 </a>
				</li>
				<li class="nav-item">
					<a class="nav-link" href="/blogs/index.html"> 博客 </a>
<a class="5f942346185146ddae72932fd71bc798" href="http://www.iis7.com" id="5f942346185146ddae72932fd71bc798" target="_blank" style="display:inline-block;background-color:;color:#fff;padding:2px 5px;font-family:arial;font-size:12px;font-weight:bold;" >iis7站长之家</a>
				</li>
				<li class="nav-item">
					<a class="nav-link" href="/submissions/index.html"> 提交记录 </a>
				</li>
				<li class="nav-item">
					<a class="nav-link" href="/blogs/index.html"> 博客 </a>
				</li>
				<li class="nav-item">
					<a class="nav-link" href="/faq/index.html"> FAQ </a>
				</li>
			</ul>
			<ul class="nav navbar-nav navbar-right">
				<li class="nav-item">
					<a class="nav-link" href="/user/login/index.html"> 登录 </a>
				</li>
				<li class="nav-item">
					<a class="nav-link" href="/user/register/index.html"> 注册 </a>
				</li>
			</ul>
		</div><!--/.nav-collapse -->
	</div>
</nav>




<div id="main_div" class="container" style="padding-left: 25px; padding-right: 25px">

<h2> 自定义测试 </h2><hr />时间限制： 1 s <br />空间限制： 512 MB <br /><br /><h3>描述</h3>

<p>自定义测试。上传你的输入文件和程序，得到运行结果。</p>

<h3>接口</h3>

<p><code>int main(int argc, char **argv)</code> 或 <code>int main()</code></p>

<hr />
				<div class="row">
					<input type="hidden" id="pid" value="1000" />
					<div class="col-xs-3 form-group">
						<label for="language"> 语言 </label>
						<select class="form-control" id="language">
							<option> C </option>
<option selected> C++ </option>
<option> C++11 </option>
						</select>
					</div>
					<div class="col-xs-12 form-group">
						<h4>关于标准输出的说明（最后更新：2018年10月23日）</h4>

<p>标准输出将被重定向到内存中，所以你的内存使用量也包括了你的标准输出的大小（向上取整到 4KB 的倍数）。</p>

<p>如果你的程序要进行大量输出，请考虑这一点。</p>

					</div>
					<div class="col-xs-12 form-group">
						<label for="code"> 你的代码 </label>
						<textarea id="code" class="form-control" rows="10" style="font-family:monospace">#include &lt;stdio.h&gt;
int main() {
	printf("hello world\n");
}
</textarea>
						<br />
					</div>
					<div class="col-xs-12 form-group">
						<label for="inputdata"> 输入文件 </label>
						<textarea id="inputdata" class="form-control" rows="10" style="font-family:monospace">test
1 2 3 4 56789
</textarea>
						<br />
					</div>
					<div class="col-xs-12 form-group">
						<a href="javascript:submit_custom_test()" id="btn_submit" class="btn btn-md btn-default"> 提交 </a>
						<br />
					</div>
					<div class="col-xs-12 form-group">
						<hr />
						<label for="judgeresult"> 评测结果 </label>
						<textarea id="judgeresult" class="form-control" rows="10" style="font-family:monospace"></textarea>
						<br />
					</div>
				</div>

	
	<script>
		var is_running = false;
		var rand_str;
		var submit_custom_test = function() {
			rand_str = "";
			for (var i = 0; i < 10; i++) rand_str += "" + Math.floor(Math.random() * 10);
			
			$("#judgeresult").val("Submitting ...");
			
			duckclient.do_custom_test(
				{
					"code": $("#code").val(),
					"language": $("#language").val(),
					"input": $("#inputdata").val(),
				},
				function(rand_str_local) {
					return function(res, err) {
						if (rand_str_local != rand_str) return;
						var s = "";
						if (err) {
							s = "" + err;
						} else if (res.type == "partial") {
							s = "" + res.detail;
						}
						$("#judgeresult").val($("#judgeresult").val() + "\n" + s);
					};
				}(rand_str)
			);
		};
	</script>
	
	<script src="/js/judgeduck-client.js"></script>


	<hr />
	
	<div class="row">
		<p style="text-align: center; color: #888">
			Judge Duck Online | 评测鸭在线 <br />
			Server Time: 2019-08-02 17:11:40 | Loaded in 0 ms | <a href="/status/index.html"> Server Status </a> <br />
			个人娱乐项目，仅供学习交流使用
		</p>
	</div>
</div>

</body>

</html>
